package cn.dgut.springboot.mini.repo;

import cn.dgut.springboot.mini.entity.Account;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

/**
 * @author 周智涛
 * @Description
 * @date 2019/12/12 11:11
 */
public interface AccountRepo extends JpaRepository<Account,Long> {

    /**
     * 通过客户id获取所有关联的账户,未测试通过
     */
    @Query(value = "select * from account a where a.customer_id=:customerId",nativeQuery = true)
    List<Account> findAccountsByCustomerId(@Param("customerId") Long customerId);


}
